a20ff4645d25cc1dec154ee3027091ce4410691e,ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/WrappedDataWatcher.java,WrappedDataWatcher,asMap,#,77
Before Change
FuzzyReflection fuzzy = FuzzyReflection.fromClass(handleType, true);
List<Field> candidates = fuzzy.getFieldListByType(Map.class);
Field match = null;
for (Field candidate : candidates) {
if (Modifier.isStatic(candidate.getModifiers())) {
// This is the entity class to current index map, which we really don't have a use for
} else {
// This is the map we're looking for
match = candidate;
}
}
if (match == null) {
throw new FieldAccessException("Could not find index -> object map.");
}
Map<Integer, ?> map = null;
try {
match.setAccessible(true);
map = (Map<Integer, ?>) match.get(handle);
} catch (IllegalArgumentException e) {
throw new FieldAccessException(e);
After Change
} else {
// This is the map we're looking for
MAP_FIELD = candidate;
MAP_FIELD.setAccessible(true);
}
}